package com.da.javatest.interview.other;

/**
 * @author chenlida
 * @date 2020/4/2 19:28
 * @description
 */
public class SuanFaDemo {
    public static void main(String[] args) {
        System.out.println(isOdd(210));
        System.out.println(isOdd(311));

        System.out.println(is2Index(1025));
        System.out.println(is2Index(128));
    }

    private static boolean isOdd(int num) {
        return (num & 1) == 1;
    }

    private static boolean is2Index(int num) {
        return (num & (num - 1)) == 0;
    }
}
